import requests


class Http_Management:

    def __init__(self, token):
        self.token = token

    def get(self, uri, params):
        get_url = "https://" + self.token.host + ":" + self.token.port + uri
        headers_get = {'Content-Type': 'application/json', 'Accept': 'application/json',
                       'X-Auth-Token': self.token.tokenNow}
        return requests.get(get_url, headers=headers_get, params={"param": params}, verify=False)
        pass

    def get_site_message(self, uri, params, siteID):
        get_url = "https://" + self.token.host + ":" + self.token.port + uri
        headers_get = {'Content-Type': 'application/json', 'Accept': 'application/json',
                       'X-Auth-Token': self.token.tokenNow, 'id': siteID}
        return requests.get(get_url, headers=headers_get, params={"param": params}, verify=False)

    def post(self, uri, body):
        post_url = "https://" + self.token.host + ":" + self.token.port + uri
        headers_post = {'Content-Type': 'application/json', 'Accept': 'application/json',
                        'X-Auth-Token': self.token.tokenNow}
        return requests.post(post_url, headers=headers_post,
                             data=body, verify=False)
